home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 4.8 KB | 143 lines |
- /*
- *
- */
-
- package symantec.itools.db.awt;
-
- import java.util.*;
- import symjava.sql.*;
- import java.lang.*;
- import symantec.itools.db.net.*;
- import symantec.itools.db.pro.*;
-
- public class Label extends java.awt.Label implements ProjLink
- {
- private ProjBinder m_ProjBinder;
-
- private String m_labelText;
- private int m_treatBlankAs = 0;
- private boolean m_DynamicUpdate = false;
-
- public Label()
- {
- super("<dbAWARE Label>");
- }
-
- public Label(String s)
- {
- super();
- m_labelText = s;
- }
-
- public void setBinding(RelationView relView, String projection)
- {
- try
- {
- int projectionNumber = relView.findProjByName(projection);
- relView.bindProj(projectionNumber, this);
- }
- catch (SQLException Ex)
- {
- raiseException(
- "SQLException from Label.setBinding: "
- + Ex.getMessage());
- }
- }
-
- public void init (ProjBinder binder)
- {
- m_ProjBinder = binder;
- }
-
- public void notifyDataChange(ProjBinder binder)
- {
- if (binder != null)
- {
- m_ProjBinder = binder;
- }
- String data = new String();
- try
- {
- if (binder.isReadable() && !binder.isNull())
- {
- data = binder.getStringValue();
- }
- }
- catch (SQLException Ex)
- {
- raiseException(
- "SQLException from Label.notifyDataChange: "
- + Ex.getMessage());
- }
- catch (java.io.IOException Ex)
- {
- raiseException(
- "IOException from Label.notifyDataChange: "
- + Ex.getMessage());
- }
- if (data.equals(""))
- {
- data = m_labelText;
- }
- setText(data);
- }
-
- public boolean notifySetData(ProjBinder binder) throws SQLException
- {
- return true;
- }
-
- public void setTreatBlankAs(String blank)
- {
- if (new String(blank).toUpperCase().equals("DEFAULT"))
- {
- m_treatBlankAs = RelationView.SETBLANKTODEFAULT;
- }
- else if (new String(blank).toUpperCase().equals("NULL"))
- {
- m_treatBlankAs = RelationView.SETBLANKTONULL;
- }
- else if (new String(blank).toUpperCase().equals("BLANK"))
- {
- m_treatBlankAs = RelationView.SETBLANKTOEMPTY;
- }
- }
-
- //*************************************************************************//
- // //
- // FUNCTION: raiseException //
- // //
- // PURPOSE: //
- // //
- // PARAMETERS: //
- // //
- // RETURNS: //
- // //
- // COMMENTS: //
- // //
- //*************************************************************************//
-
- void raiseException(String text)
- {
- System.out.println(text);
- }
-
- //*************************************************************************//
- // //
- // FUNCTION: setDynamicUpdate //
- // //
- // PURPOSE: //
- // //
- // PARAMETERS: //
- // //
- // RETURNS: //
- // //
- // COMMENTS: //
- // //
- //*************************************************************************//
-
- public void setDynamicUpdate(boolean update)
- {
- m_DynamicUpdate = update;
- }
- }